//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.come.until;

import java.math.BigDecimal;

public class AnalysisString {
	public AnalysisString() {
	}

	public static boolean jiaoyi(long type) {
		return type == 1L || type == 3L || type == 5L;
	}

	public static int[] yao(String value) {
		int[] yao = new int[4];
		String[] names = value.split("\\|");

		for(int i = 0; i < names.length; ++i) {
			if (names[i].split("=").length >= 2) {
				if ("HP".equals(names[i].split("=")[0])) {
					yao[0] = Integer.parseInt(names[i].split("=")[1]);
				} else if ("MP".equals(names[i].split("=")[0])) {
					yao[1] = Integer.parseInt(names[i].split("=")[1]);
				} else if ("HP%".equals(names[i].split("=")[0])) {
					yao[2] = Integer.parseInt(names[i].split("=")[1]);
				} else if ("MP%".equals(names[i].split("=")[0])) {
					yao[3] = Integer.parseInt(names[i].split("=")[1]);
				}
			}
		}

		return yao;
	}

	public static long[] xiaohao(String value) {
		long[] xiaohao = new long[5];
		String[] names = value.split("\\|");

		for(int i = 0; i < names.length; ++i) {
			if (names[i].split("=").length >= 2) {
				if ("钱".equals(names[i].split("=")[0])) {
					xiaohao[0] = Long.parseLong(names[i].split("=")[1]);
				} else if ("点".equals(names[i].split("=")[0])) {
					xiaohao[1] = Long.parseLong(names[i].split("=")[1]);
				} else if ("经验".equals(names[i].split("=")[0])) {
					xiaohao[2] = Long.parseLong(names[i].split("=")[1]);
				} else if ("亲密".equals(names[i].split("=")[0])) {
					xiaohao[3] = Long.parseLong(names[i].split("=")[1]);
				} else if ("技能".equals(names[i].split("=")[0])) {
					xiaohao[4] = Long.parseLong(names[i].split("=")[1]);
				}
			}
		}

		return xiaohao;
	}

	public static int shuliandu(int lvl) {
		int sld = 5000;
		
		if (lvl <= 102) {
			sld = sld + 5000;
		} else if (lvl <= 210) {
			sld = sld + 10000;
		} else if (lvl <= 338) {
			sld = sld + 15000;
		} else {
			sld = sld + 20000;
		}

		return sld;
	}

	public static String lvl(int lvl) {
		if (lvl <= 102) {
			return "0转" + lvl;
		} else if (lvl <= 210) {
			return "1转" + (lvl - 102 + 14);
		} else if (lvl <= 338) {
			return "2转" + (lvl - 210 + 14);
		} else {
			return lvl <= 459 ? "3转" + (lvl - 338 + 59) : "飞升" + (lvl - 459 + 139);
		}
	}

	public static int lvltrue(int lvl) {
		if (lvl <= 102) {
			return 0;
		} else if (lvl <= 210) {
			return 1;
		} else if (lvl <= 338) {
			return 2;
		} else {
			return lvl <= 459 ? 3 : 4;
		}
	}

	public static String petLvl(int lvl) {
		if (lvl <= 100) {
			return "0转" + lvl;
		} else if (lvl <= 221) {
			return "1转" + (lvl - 101);
		} else if (lvl <= 362) {
			return "2转" + (lvl - 222);
		} else {
			return lvl <= 543 ? "3转" + (lvl - 363) : "点化" + (lvl - 544);
		}
	}

	public static int petTurnRount(int lvl) {
		if (lvl <= 100) {
			return 0;
		} else if (lvl <= 221) {
			return 1;
		} else if (lvl <= 362) {
			return 2;
		} else {
			return lvl <= 543 ? 3 : 4;
		}
	}

	public static int petLvlint(int lvl) {
		if (lvl <= 100) {
			return lvl;
		} else if (lvl <= 221) {
			return lvl - 101;
		} else if (lvl <= 362) {
			return lvl - 222;
		} else {
			return lvl <= 543 ? lvl - 363 : lvl - 544;
		}
	}

	public static BigDecimal mathDouble(double v1, double v2) {
		BigDecimal b1 = new BigDecimal(Double.toString(v1));
		BigDecimal b2 = new BigDecimal(Double.toString(v2));
		return b1.add(b2);
	}

	public static BigDecimal reduceDouble(double v1, double v2) {
		BigDecimal b1 = new BigDecimal(Double.toString(v1));
		BigDecimal b2 = new BigDecimal(Double.toString(v2));
		return b1.subtract(b2);
	}

	public static void main(String[] args) {
		//system.out.println(lvlint(448));
	}

	public static int lvlint(int lvl) {
		if (lvl <= 102) {
			return lvl;
		} else if (lvl <= 210) {
			return lvl - 102 + 14;
		} else if (lvl <= 338) {
			return lvl - 210 + 14;
		} else {
			return lvl <= 459 ? lvl - 338 + 59 : lvl - 459 + 139;
		}
	}

	public static int xiuwei(int lvl) {
		return lvl < 150 ? 6 : lvl - 144;
	}

	public static int xwUP(int lvl) {
		return xiuwei(lvl) * 5;
	}

	public static int lvldirection(String lvlstring) {
		String[] lvls = lvlstring.split("转");
		if (lvls.length == 1) {
			return Integer.parseInt(lvls[0]);
		} else if ("1".equals(lvls[0])) {
			return Integer.parseInt(lvls[1]) + 102 - 14;
		} else if ("2".equals(lvls[0])) {
			return Integer.parseInt(lvls[1]) + 210 - 14;
		} else if ("3".equals(lvls[0])) {
			return Integer.parseInt(lvls[1]) + 338 - 59;
		} else {
			return lvlstring.indexOf("飞升") == 0 ? Integer.parseInt(lvlstring.split("升")[1]) + 459 - 139 : Integer.parseInt(lvls[1]);
		}
	}
	public static int lvldirection1(String lvlstring) {
		String[] lvlf = lvlstring.split("升");
		String[] lvls = lvlstring.split("转");
		if (!lvlstring.contains("飞升")){
			if (lvls.length == 1) {
				return Integer.parseInt(lvls[0]);
			} else if (lvls[0].equals("1")) {
				return Integer.parseInt(lvls[1]) + 102 - 14;
			} else if (lvls[0].equals("2")) {
				return Integer.parseInt(lvls[1]) + 210 - 14;
			} else if (lvls[0].equals("3")) {
				return Integer.parseInt(lvls[1]) + 338 - 59;
			} else {
				return lvlstring.indexOf("飞升") == 0 ? Integer.parseInt(lvlstring.split("升")[1]) + 459 - 139 : Integer.parseInt(lvls[1]);
			}
		}else{
			return lvlstring.indexOf("飞升") == 0 ? Integer.parseInt(lvlstring.split("升")[1]) + 459 - 139 : Integer.parseInt(lvlf[1]);
		}
	}
	public static boolean lvlfull(int lvl, String lvlstring) {
		return lvl >= lvldirection(lvlstring);
	}

	public static boolean lvlfull2(int lvl, String lvlstring) {
		return lvl <= lvldirection(lvlstring);
	}

	public static double valuejie(String value, String type) {
		String[] v = value.split("\\|");

		for(int i = 0; i < v.length; ++i) {
			String[] v2 = v[i].split("=");
			if (v2.length > 1 && type.equals(v2[0])) {
				if (!"活跃".equals(type) && !"速度".equals(type) && !"负敏".equals(type)) {
					return Double.parseDouble(v2[1]) / 100.0D;
				}

				return Double.parseDouble(v2[1]);
			}
		}

		return 0.0D;
	}
}
